import numpy as np
from matplotlib import pyplot as plt
import glob
import os
root_dir = '/mnt/nvme1n1/statistic_data'
mean_mat = glob.glob(os.path.join(root_dir, 'mean_*'))

mean_mat = list()
max_mat = list()
min_mat = list()

for i in range(1, 743):
    cur_mean = np.load(os.path.join(root_dir, f'mean_{i}.npy'))
    mean_mat.append(cur_mean)

    cur_max = np.load(os.path.join(root_dir, f'max_{i}.npy'))
    max_mat.append(cur_max)

    cur_min = np.load(os.path.join(root_dir, f'min_{i}.npy'))
    min_mat.append(cur_min)
final_mean = np.stack(mean_mat, axis=0)
final_max = np.stack(max_mat, axis=0)
final_min = np.stack(min_mat, axis=0)
print(final_mean.shape)

save_dir = '/root/liulei/gc_ice_pred_0127/data_image'
X = range(1, 743)
for i in range(50):

    plt.plot(X, final_mean[:, i])
    plt.plot(X, final_max[:, i])
    plt.plot(X, final_min[:, i])
    plt.savefig(os.path.join(save_dir, f'image_{i}.png'), dpi=300)
    plt.close()